"""backend URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import re_path

from django.views import static ##新增
from django.conf import settings ##新增

from Route import Index
from Route.User import UserView
from Route.Contact import ContactUs
from Route.Access import Access
from Route.Resquery import Query
from Route.AdminQuery import Admin

from django.views.generic import TemplateView

from Route.template import index

urlpatterns = [
    # path('',Index.hello_Django),
    path('', TemplateView.as_view(template_name="index.html")),
    # 用户管理
    path('user/reg/',UserView.Register),             # 注册
    path('user/login/',UserView.Login),              # 登录
    path('user/loginout/',UserView.LoginOut),        # 登出
    path('user/forget/',UserView.ForgetPwd),         # 忘记密码
    path('user/sendmail/',UserView.SendMail),        # 发邮件获得6位验证码
    path('user/resetpwd/',UserView.ResetPwd),        # 重置密码

    # 联系我们
    path('contact/img/',ContactUs.GetImg),
    path('contact/detail/',ContactUs.GetCommentDetail),

    # 测评  
    path('access/info/',Access.InfoCollection),
    path('access/creative/',Access.CreativeCalc),
    path('access/adventure/',Access.AdventureCalc),
    path('access/raven/',Access.RavenCalc),
    path('access/match/',Access.MatchCalc),
    path('access/logic/',Access.LogicCalc),
    path('access/hanoi/',Access.HanoiCalc),
    path('access/room/',Access.RoomCalc),
    path('access/final/',Access.FinalCalc),

    path('template/',index),

    # 结果查询
    path('query/personalinfo/',Query.queryPersonalInfo),

    path('admin/query/',Admin.queryPersonalInfo),

    # 静态资源
    re_path(r'^static/(?P<path>.*)$', static.serve,
      {'document_root': settings.STATIC_ROOT}, name='static'),

	# .....
    re_path(r'^media/(?P<path>.*)$', static.serve,
         {'document_root': settings.MEDIA_ROOT})
]
